class Video < ActiveRecord::Base
  belongs_to :ecase
  belongs_to :author, :class_name => "User", :foreign_key => "author_id"
  validates_format_of :url, 
    :with => %r{\.(avi|mov)$}i,
    :message => "must point to AVI or MOV file"
  file_column :url

  def category
    ResourceCategory::VIDEO
  end

  def name
    read_attribute(:url).split("/").last
  end
end